package org.kiwi.data.vo;

import lombok.Data;
import org.kiwi.data.enums.DbType;
import org.kiwi.data.enums.LbType;
import org.kiwi.data.enums.PoolType;
import org.kiwi.data.enums.StateType;

import java.io.Serializable;
import java.util.List;
import java.util.Properties;

/**
 * Created by jack08.liu on 2016/10/20.
 */
@Data
public class DataSourceMetaVO implements Serializable {

    private String id;
    private String dbType = DbType.MYSQL.getText();
    private String state = StateType.ONLINE.getText();

    private List<GroupDataSourceMetaVO> groups;

    @Data
    public static class GroupDataSourceMetaVO implements Serializable {
        private String groupName;
        private String state = StateType.ONLINE.getText();
        private String loadBalance = LbType.ROUNDROBIN.getText();

        private List<ReadWriteMetaVO> atomicDss;
    }

    @Data
    public static class ReadWriteMetaVO implements Serializable {
        private String dsName;
        private String host;
        private String port;
        private String username;
        private String password;
        private String param;
        private String scheme;
        private Integer lbWeight = 1;
        private Boolean isMaster = false;
        private String state = StateType.ONLINE.getText();
        private String poolType = PoolType.DRUID.getText();
        private Properties poolConfig;
    }
}
